//
//  WelcomController.swift
//  SwiftWB
//
//  Created by 远成物流 on 2017/6/28.
//
//

import UIKit
import SDWebImage

class WelcomController: UIViewController {

    @IBOutlet weak var avatarImgBottomCons: NSLayoutConstraint!
    @IBOutlet weak var avatarImg: UIImageView!
    @IBOutlet weak var welcomeLab: UILabel!
    
    override func viewDidLoad() {
        super.viewDidLoad()

        //设置头像
        avatarImg.layer.cornerRadius = avatarImg.frame.size.height * 0.5
        let avatarUrl = UserAccoutViewModel.shareInstance.account?.avatar_large
        avatarImg.sd_setImage(with: URL(string:avatarUrl ?? ""), placeholderImage: UIImage(named: "avatar_default_big"))
        
        // 改变约束的值
        avatarImgBottomCons.constant = UIScreen.main.bounds.height - 250
        
        // Damping:值越大阻力越大
        // initialSpringVelocity : 初始化速度
        UIView.animate(withDuration: 1.5, delay: 0.0, usingSpringWithDamping: 0.7, initialSpringVelocity: 5.0, options: .curveLinear, animations: {
            
            self.view.layoutIfNeeded()
            
        }) { (_) in
            UIApplication.shared.keyWindow?.rootViewController = UIStoryboard(name: "Main", bundle: nil).instantiateInitialViewController()
        }
    }

    override func didReceiveMemoryWarning() {
        super.didReceiveMemoryWarning()
        // Dispose of any resources that can be recreated.
    }

}
